HAL GFXTIM types migration ¶
This section provides information about the HAL GFXTIM types migration.
HAL GFXTIM initialization type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t SynchroSrc;
uint32_t TearingEffectSrc;
uint32_t TearingEffectPolarity;
uint32_t TearingEffectInterrupt;
} GFXTIM_InitTypeDef;
|
hal_status_t HAL_GFXTIM_SetSyncSource(hal_gfxtim_handle_t *hgfxtim,
hal_gfxtim_sync_src_t sync_src);
typedef struct
{
hal_gfxtim_tearing_effect_src_t src;
hal_gfxtim_tearing_effect_polarity_t polarity;
} hal_gfxtim_tearing_effect_config_t;
hal_status_t HAL_GFXTIM_EnableTearingEffectIT(hal_gfxtim_handle_t *hgfxtim);
hal_status_t HAL_GFXTIM_DisableTearingEffectIT(hal_gfxtim_handle_t *hgfxtim);
Note In HAL2 synchronization source is only available in some stm32 devices. Please check the ref-man of your product. |
|
Usage example: /* This example is used with STM32U5 */
GFXTIM_HandleTypeDef hgfxtim;
hgfxtim.Instance = GFXTIM;
hgfxtim.Init.SynchroSrc = GFXTIM_SYNC_SRC_HSYNC_VSYNC_0;
hgfxtim.Init.TearingEffectSrc = GFXTIM_TE_SRC_VSYNC;
hgfxtim.Init.TearingEffectPolarity = GFXTIM_TE_FALLING_EDGE;
hgfxtim.Init.TearingEffectInterrupt = ENABLE;
HAL_GFXTIM_Init(&hgfxtim);
|
Usage example: /* This example is used with STM32U5 */
hal_gfxtim_handle_t hgfxtim;
HAL_GFXTIM_Init(&hgfxtim, HAL_GFXTIM);
hal_gfxtim_tearing_effect_config_t p_config;
/* removed : the LTDC is the only synchronization source */
p_config.src= HAL_GFXTIM_TEARING_EFFECT_VSYNC;
p_config.polarity = HAL_GFXTIM_TEARING_EFFECT_FALLING_EDGE;
HAL_GFXTIM_SetConfigTearingEffect(&hgfxtim, &p_config);
HAL_GFXTIM_EnableTearingEffectIT(&hgfxtim);
|
HAL GFXTIM clock generator configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
In HAL2, the clock generator configuration is split into line clock generator configuration and frame clock generator configuration |
|
typedef struct
{
uint32_t LCCHwReloadSrc;
uint32_t LCCReloadValue;
uint32_t LCCClockSrc;
uint32_t LineClockSrc;
uint32_t LineClockCalib;
uint32_t FCCHwReloadSrc;
uint32_t FCCReloadValue;
uint32_t FCCClockSrc;
uint32_t FrameClockSrc;
uint32_t FrameClockCalib;
} GFXTIM_ClockGeneratorConfigTypeDef;
|
typedef struct
{
hal_gfxtim_clkgen_line_count_reload_src_t reload_src;
uint32_t reload_val;
hal_gfxtim_clkgen_line_count_src_t counter_src;
hal_gfxtim_clkgen_line_clk_src_t clock_src;
} hal_gfxtim_clkgen_line_config_t;
hal_status_t HAL_GFXTIM_CLKGEN_EnableLineClkCalibOutput(hal_gfxtim_handle_t *hgfxtim);
hal_status_t HAL_GFXTIM_CLKGEN_DisableLineClkCalibOutput(hal_gfxtim_handle_t *hgfxtim);
typedef struct
{
hal_gfxtim_clkgen_frame_count_reload_src_t reload_src;
uint32_t reload_val;
hal_gfxtim_clkgen_frame_count_src_t counter_src;
hal_gfxtim_clkgen_frame_clk_src_t clock_src;
} hal_gfxtim_clkgen_frame_config_t;
hal_status_t HAL_GFXTIM_CLKGEN_EnableFrameClkCalibOutput(hal_gfxtim_handle_t *hgfxtim);
hal_status_t HAL_GFXTIM_CLKGEN_DisableFrameClkCalibOutput(hal_gfxtim_handle_t *hgfxtim);
|
HAL GFXTIM absolute timer configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
In HAL2, the absolute timer configuration parameters are managed by HAL unitary functions. The interrupt flags have been removed from the configuration structure and are managed directly by the HAL function HAL_GFXTIM_ABSTIM_Start. |
|
typedef struct
{
uint32_t FrameCompare1Value;
uint32_t FrameCounterValue;
uint32_t LineCompare1Value;
uint32_t LineCompare2Value;
uint32_t LineCounterValue;
uint32_t FrameOverflowInterrupt;
uint32_t FrameCompare1Interrupt;
uint32_t LineOverflowInterrupt;
uint32_t LineCompare1Interrupt;
uint32_t LineCompare2Interrupt;
} GFXTIM_AbsoluteTimerConfigTypeDef;
|
hal_status_t HAL_GFXTIM_ABSTIM_SetFrameCompareValue(hal_gfxtim_handle_t *hgfxtim,
uint32_t val);
hal_status_t HAL_GFXTIM_ABSTIM_SetFrameCounter(const hal_gfxtim_handle_t *hgfxtim,
uint32_t val);
hal_status_t HAL_GFXTIM_ABSTIM_SetLineCompareValue(hal_gfxtim_handle_t *hgfxtim,
hal_gfxtim_abstim_line_comp_t line_comp,
uint32_t val);
hal_status_t HAL_GFXTIM_ABSTIM_SetLineCounter(const hal_gfxtim_handle_t *hgfxtim,
uint32_t val);
hal_status_t HAL_GFXTIM_ABSTIM_Start(hal_gfxtim_handle_t *hgfxtim,
hal_gfxtim_abstim_counter_t counter,
uint32_t interrupts);
|
|
Usage example: /* Absolute line and frame counter configuration with interrupt enabled */
GFXTIM_AbsoluteTimerConfigTypeDef pAbsoluteTimerConfig = {
.LineCounterValue = 0;
.LineCompare1Value = 1500;
.LineCompare2Value = 3000;
.FrameCounterValue = 0xFFFF0;
.FrameCompare1Value = 0xFFFFA;
.FrameOverflowInterrupt = ENABLE;
.FrameCompare1Interrupt = ENABLE;
.LineOverflowInterrupt = ENABLE;
.LineCompare1Interrupt = ENABLE;
.LineCompare2Interrupt = ENABLE;
};
HAL_GFXTIM_AbsoluteTimer_Config(&hgfxtim, &pAbsoluteTimerConfig);
|
Usage example: /* Absolute line and frame counter configuration with interrupt enabled */
HAL_GFXTIM_ABSTIM_SetLineCounter(&hgfxtim, 0U);
HAL_GFXTIM_ABSTIM_SetLineCompareValue(&hgfxtim,
HAL_GFXTIM_ABSTIM_LINE_COMP_1,
1500U);
HAL_GFXTIM_ABSTIM_SetLineCompareValue(&hgfxtim,
HAL_GFXTIM_ABSTIM_LINE_COMP_2,
3000U);
HAL_GFXTIM_ABSTIM_SetFrameCounter(&hgfxtim, 0xFFFF0U);
HAL_GFXTIM_ABSTIM_SetFrameCompareValue(&hgfxtim, 0xFFFFAU);
HAL_GFXTIM_ABSTIM_Start(&hgfxtim,
HAL_GFXTIM_ABSTIM_LINE_FRAME_COUNTER,
(HAL_GFXTIM_ABSTIM_FRAME_ALL_IT | HAL_GFXTIM_ABSTIM_LINE_ALL_IT));
|
HAL GFXTIM relative timer configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
In HAL1, GFXTIM_RelativeTimerConfigTypeDef is used with HAL_GFXTIM_RelativeTimer_Config() API to configure relative timer. typedef struct
{
uint32_t CounterMode;
uint32_t AutoReloadValue;
uint32_t ReloadInterrupt;
} GFXTIM_RelativeTimerConfigTypeDef;
|
Removed:
In HAL2, the GFXTIM relative timer configuration is no more available,
the equivalent functionality has been merged with start relative timer API
according to the counter mode (continuous or one shot).
For more details, see HAL GFXTIM start the relative timer |
Related use cases: Use case: Starting the GFXTIM with relative timer
HAL GFXTIM event generator configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
In HAL2, the event generator configuration parameters are managed by HAL unitary functions. The event interrupt flag has been removed from the configuration structure and is managed directly by the HAL function HAL_GFXTIM_EVENTGEN_Start. |
|
typedef struct
{
uint32_t LineEvent;
uint32_t FrameEvent;
uint32_t EventInterrupt;
} GFXTIM_EventGeneratorConfigTypeDef;
|
typedef struct
{
hal_gfxtim_eventgen_line_src_t line_event,
hal_gfxtim_eventgen_frame_src_t frame_event,
} hal_gfxtim_eventgen_config_t;
hal_status_t HAL_GFXTIM_EVENTGEN_Start(const hal_gfxtim_handle_t *hgfxtim,
hal_gfxtim_eventgen_event_t event_gen,
uint32_t interrupt);
|
|
Usage example: /* Configure the event generator with interrupt enabled */
GFXTIM_EventGeneratorConfigTypeDef EventConfig = {
.FrameEvent = GFXTIM_FRAME_EVENT_RFC2_RELOAD;
.LineEvent = GFXTIM_LINE_EVENT_ALC2_COMPARE;
.EventInterrupt = GFXTIM_IT_ENABLE;
};
HAL_GFXTIM_EventGenerator_Config(&hgfxtim,
GFXTIM_EVENT_GENERATOR_2,
&EventConfig);
|
Usage example: /* Configure the event generator with interrupt enabled */
hal_gfxtim_eventgen_config_t p_config = {
.frame_event = HAL_GFXTIM_EVENTGEN_REL_FCNT_2_RELOAD;
.line_event = HAL_GFXTIM_EVENTGEN_ABS_LCNT_2_COMP;
};
HAL_GFXTIM_EVENTGEN_SetConfig(&hgfxtim,
HAL_GFXTIM_EVENTGEN_EVENT_2,
&p_config);
HAL_GFXTIM_EVENTGEN_Start(&hgfxtim,
HAL_GFXTIM_EVENTGEN_EVENT_2,
HAL_GFXTIM_EVENTGEN_EVENT_IT);
|
Related use case: Use case: Starting the GFXTIM with event generator
HAL GFXTIM watchdog configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t ClockSrc;
uint32_t AutoReloadValue;
uint32_t HwReloadConfig;
uint32_t PreAlarmValue;
uint32_t AlarmInterrupt;
uint32_t PreAlarmInterrupt;
} GFXTIM_WatchdogConfigTypeDef;
|
In HAL2, the watchdog configuration keeps only the clock source, and all remaining members are managed by HAL watchdog start API function. typedef struct
{
hal_gfxtim_wdg_clk_src_t src;
} hal_gfxtim_wdg_config_t;
hal_status_t HAL_GFXTIM_WDG_Start(hal_gfxtim_handle_t *hgfxtim,
uint32_t reload_val,
uint32_t prealarm_val,
uint32_t interrupts);
Note In HAL2, hardware reload config is removed. See HAL GFXTIM watchdog hardware reload options constants for more details. |
|
Usage example: /* Configure watchdog counter */
GFXTIM_WatchdogConfigTypeDef WatchdogConfig;
WatchdogConfig.ClockSrc = GFXTIM_WATCHDOG_CLK_SRC_LINE_CLK;
WatchdogConfig.HwReloadConfig = GFXTIM_WATCHDOG_HW_RELOAD_DISABLE;
WatchdogConfig.AutoReloadValue = 100;
WatchdogConfig.PreAlarmValue = 50;
WatchdogConfig.AlarmInterrupt = GFXTIM_IT_ENABLE;
WatchdogConfig.PreAlarmInterrupt = GFXTIM_IT_ENABLE;
HAL_GFXTIM_WatchdogTimer_Config(&hgfxtim, &WatchdogConfig);
|
Usage example: /* Configure and start watchdog counter */
hal_gfxtim_wdg_config_t p_wdg_config;
p_wdg_config.src = HAL_GFXTIM_WDG_CLK_LINE_CLK;
HAL_GFXTIM_WDG_SetConfig(&hgfxtim, &p_wdg_config)
HAL_GFXTIM_WDG_Start(&hgfxtim,
100,
50,
HAL_GFXTIM_WDG_ALL_IT);
|
Related use cases: Use case: Starting the GFXTIM with watchdog timer
HAL GFXTIM callback ID type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_GFXTIM_AFC_COMPARE1_CB_ID,
HAL_GFXTIM_AFC_OVERFLOW_CB_ID,
HAL_GFXTIM_ALC_COMPARE1_CB_ID,
HAL_GFXTIM_ALC_COMPARE2_CB_ID,
HAL_GFXTIM_ALC_OVERFLOW_CB_ID,
HAL_GFXTIM_RFC1_RELOAD_CB_ID,
HAL_GFXTIM_RFC2_RELOAD_CB_ID,
HAL_GFXTIM_TE_CB_ID,
HAL_GFXTIM_EVENT1_CB_ID,
HAL_GFXTIM_EVENT2_CB_ID,
HAL_GFXTIM_EVENT3_CB_ID,
HAL_GFXTIM_EVENT4_CB_ID,
HAL_GFXTIM_WDG_ALARM_CB_ID,
HAL_GFXTIM_WDG_PREALARM_CB_ID,
HAL_GFXTIM_ERROR_CB_ID,
HAL_GFXTIM_MSP_INIT_CB_ID,
HAL_GFXTIM_MSP_DEINIT_CB_ID,
} HAL_GFXTIM_CallbackIDTypeDef;
|
|
Related concepts:
HAL GFXTIM callback type definition ¶
|
HAL1 |
HAL2 |
|---|---|
pGFXTIM_CallbackTypeDef
|
hal_gfxtim_cb_t
|
Related concept:
HAL GFXTIM state type definition ¶
In HAL2, the state machine of the GFXTIM is split into six separate state machines:
Global state machine: driver global process
Clock generator state machine : clock generator subprocess
Absolute line counter state machine: absolute line subprocess
Absolute frame counter machine: driver absolute frame subprocess
Relative frame counter state machine : relative timer subprocess
Watchdog counter state machine: watchdog subprocess
|
HAL1 |
HAL2 |
|---|---|
|
|
Related concept:
HAL GFXTIM handle type definition ¶
|
HAL1 |
HAL2 |
|---|---|
GFXTIM_HandleTypeDef
|
hal_gfxtim_handle_t
|
Related concept: